class KnowledgesModel {

  final List<KnowledgeModel>? data;
  final num? errorCode;
  final String? errorMsg;

  KnowledgesModel({
    this.data,
    this.errorCode,
    this.errorMsg,
  });

  factory KnowledgesModel.fromJson(Map<String, dynamic> json) {
    return KnowledgesModel(
      data: json['data'] == null
          ? null
          : List<KnowledgeModel>.from(json['data'].map((x) => KnowledgeModel.fromJson(x))),
      errorCode: json['errorCode'],
      errorMsg: json['errorMsg'],
    );
  }

  Map<String, dynamic> toJson() => {
        'data': data?.map((e) => e.toJson()).toList(),
        'errorCode': errorCode,
        'errorMsg': errorMsg,
      };
}

class KnowledgeModel {
// {
//     "articleList": [],
//     "author": "",
//     "courseId": 13,
//     "cover": "",
//     "desc": "",
//     "id": 150,
//     "lisense": "",
//     "lisenseLink": "",
//     "name": "开发环境",
//     "order": 1,
//     "parentChapterId": 0,
//     "type": 0,
//     "userControlSetTop": false,
//     "visible": 1
// }

  final List? articleList;
  final String? author;
  final List<KnowledgeModel>? children;
  final num? courseId;
  final String? cover;
  final String? desc;
  final num? id;
  final String? lisense;
  final String? lisenseLink;
  final String? name;
  final num? order;
  final num? parentChapterId;
  final num? type;
  final bool? userControlSetTop;
  final num? visible;

  KnowledgeModel({
    this.articleList,
    this.author,
    this.children,
    this.courseId,
    this.cover,
    this.desc,
    this.id,
    this.lisense,
    this.lisenseLink,
    this.name,
    this.order,
    this.parentChapterId,
    this.type,
    this.userControlSetTop,
    this.visible,
  });

  factory KnowledgeModel.fromJson(Map<String, dynamic> json) {
    return KnowledgeModel(
      articleList: json['articleList'],
      author: json['author'],
      children: json['children'] == null
          ? null
          : List<KnowledgeModel>.from(json['children'].map((x) => KnowledgeModel.fromJson(x))),
      courseId: json['courseId'],
      cover: json['cover'],
      desc: json['desc'],
      id: json['id'],
      lisense: json['lisense'],
      lisenseLink: json['lisenseLink'],
      name: json['name'],
      order: json['order'],
      parentChapterId: json['parentChapterId'],
      type: json['type'],
      userControlSetTop: json['userControlSetTop'],
      visible: json['visible'],
    );
  }

  Map<String, dynamic> toJson() => {
        'articleList': articleList,
        'author': author,
        'children': children?.map((e) => e.toJson()).toList(),
        'courseId': courseId,
        'cover': cover,
        'desc': desc,
        'id': id,
        'lisense': lisense,
        'lisenseLink': lisenseLink,
        'name': name,
        'order': order,
        'parentChapterId': parentChapterId,
        'type': type,
        'userControlSetTop': userControlSetTop,
        'visible': visible,
      };
}
